﻿
namespace NavPlus
{
    public class GreedyNavigation : BaseNavigation
    {
        protected override void DetectNeighborGrid(NavGridLogic detectGrid, NavGridLogic neighborGrid)
        {
            if (!m_CloseLst.Contains(neighborGrid) &&
               !m_OpenQue.Contains(neighborGrid))
            {
                neighborGrid.OnViewChange(ViewState.CheckedPoint);
                float neighborDistance = NavGridLogic.GetLogicGridDistance(detectGrid, neighborGrid);
                neighborGrid.SumDistance = detectGrid.SumDistance + neighborDistance;

                neighborGrid.Priority = NavGridLogic.GetLogicGridDistance(neighborGrid, m_EndGrid);
                neighborGrid.PreGrid = detectGrid;
                m_OpenQue.Enqueue(neighborGrid);

                // 检测完更新方向信息
                neighborGrid.OnViewChange(ViewState.DebugDir);
            }
        }
    }
}
